package com.itheima.mystream;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

/**
 * Stream流的中间方法
 * 需求改进: 保留以张开头并且长度为3并且以丰结尾的数据,将这部分数据遍历打印输出
 */

public class Demo4 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("张三丰","张无忌","张翠山","王二麻子","张良","谢广坤"));
        //创建一个stream流
        Stream<String> stream = list.stream();
        stream.filter(s -> s.length() ==3).filter(s -> s.startsWith("张")).filter(s -> s.endsWith("丰")).forEach(s -> System.out.println(s));
    }
}
